package com.company.instance;

/**
 * 饿汉模式
 */
public class InstanceTest {

    static InstanceTest instanceTest=null;
    private InstanceTest(){

    }

    public static InstanceTest getInstance(){
        if (instanceTest == null) {
            synchronized (InstanceTest.class){
                if(instanceTest==null){
                    instanceTest=new InstanceTest();
                }
            }
        }
        return instanceTest;
    }

    @Override
    public String toString() {
        return "InstanceTest{}";
    }
}
